%table#runs
  -if runs
    %tr
      %td= sort_runs_by_tag "Run ID","run",problem,contest,user,order
      -if !@user
        %td= sort_runs_by_tag "User","user",problem,contest,user,order
      -if !@contest
        %td Contest:
      -if !@problem
        %td= sort_runs_by_tag "Problem","problem",problem,contest,user,order
      %td= sort_runs_by_tag "Language:","language",problem,contest,user,order
      %td= sort_runs_by_tag "About:","about",problem,contest,user,order
      %td= sort_runs_by_tag "Time:","submit_time",problem,contest,user,order
      %td= sort_runs_by_tag "Status","status",problem,contest,user,order
    -runs.each do |run|
      - klas = ""
      -if ok_status?(run.status)
        - klas = "ok_submit"
      -elsif judged_status?(run.status)
        - klas = "wrong_submit"
      -else
        - klas = "unjudged_submit"
      %tr{ :class => "#{klas}"}
        -if admin? session[:user]
          %td= link_to run.run_id,:controller => :spoj1_admin,:action => :rejudge_run,:id => run
        -else
          %td= run.run_id
        -if !@user
          %td= link_to run.potrebitel.login,:action => :status,:user => run.potrebitel.id,:problem => problem,:contest => contest,:order => order
        -if !@contest
          %td= link_to run.problem.contest.name, :action => :status,:contest => run.problem.contest,:user => user,:order => order
        -if !@problem
          %td= link_to run.problem.name,:action => :status,:problem => run.problem, :user => user,:order => order
        %td= link_to run.language,:controller => :runs,:action => :show,:id => run.run_id
        %td= run.about
        %td= printable_time run.submit_time
        %td
          -if judged_status? run.status
            -unless compile_error_status? run.status
              = run.status
            -else
              = link_to run.status,:action => :show_log, :run => run
          -else
            = run.status
  -else
    No runs found!!!
